<template>
  <div id="app">
    <header>
      <b>QQ音乐</b>
      <button>下载app</button>
    </header>
    <TabTitle :list="list" :activeIndex="activeIndex"></TabTitle>
    <TabCont :children="list[activeIndex].children" />
  </div>
</template>

<script>
import TabTitle from "./components/TabTitle.vue";
import TabCont from "./components/TabCont.vue";
import Mock from "mockjs";
const data = Mock.mock({
  "list|3": [
    {
      title: "@ctitle(3)",
      "children|5": [
        {
          img: "@image(100x100,@color)",
          name: "@cname",
          "songs|3": [
            {
              singer: "@cname",
              song: "@cname",
            },
          ],
        },
      ],
    },
  ],
});

export default {
  name: "App",
  components: {
    TabTitle,
    TabCont,
  },
  data() {
    return {
      list: data.list,
      activeIndex: 0,
    };
  },
  mounted() {
    this.bus.$on("changeActive", (index) => {
      this.activeIndex = index;
    });
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}
html,
body,
#app {
  width: 100%;
  height: 100px;
}
</style>
